package com.hmy.finance.dal.po;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.hmy.finance.common.enums.StatementStatusEnum;
import com.hmy.finance.api.bo.core.request.enums.StatementTypeEnum;
import com.hmy.finance.dal.po.json.CustomerExtensionInfoJson;
import com.hmy.finance.dal.po.json.FeeDetailJson;
import com.hmy.finance.dal.po.json.ReconciliationAdjustJson;
import lombok.Data;
import org.apache.ibatis.type.EnumTypeHandler;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 对账单
 *
 * @TableName reconciliation_statement
 */
@TableName(value = "reconciliation_statement")
@Data
public class ReconciliationStatementPo implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = -4718382697160354653L;
    /**
     * 主键ID
     */
    @TableId(value = "statement_id", type = IdType.ASSIGN_ID)
    private Long statementId;

    /**
     * 账单编号
     */
    @TableField(value = "statement_no")
    private String statementNo;

    /**
     * 客户ID
     */
    @TableField(value = "customer_id")
    private Long customerId;

    /**
     * 签约人ID
     */
    @TableField(value = "signatory_id")
    private Long signatoryId;

    /**
     * 订单合同id
     */
    @TableField(value = "order_contract_id")
    private Long orderContractId;

    /**
     * 订单合同编号
     */
    @TableField(value = "order_contract_no")
    private String orderContractNo;

    /**
     * 项目名称拼接
     */
    @TableField(value = "project_name")
    private String projectName;

    /**
     * 对账开始时间
     */
    @TableField(value = "reconciliation_start_date")
    private LocalDateTime reconciliationStartDate;

    /**
     * 对账结束时间
     */
    @TableField(value = "reconciliation_end_date")
    private LocalDateTime reconciliationEndDate;

    /**
     * 本期费用合计
     */
    @TableField(value = "reconciliation_total_amount")
    private BigDecimal reconciliationTotalAmount;

    /**
     * 本期费用小计
     */
    @TableField(value = "reconciliation_subtotal", typeHandler = JacksonTypeHandler.class)
    private FeeDetailJson reconciliationSubtotal;

    /**
     * 本期费用调整
     */
    @TableField(value = "reconciliation_adjust", typeHandler = JacksonTypeHandler.class)
    private ReconciliationAdjustJson reconciliationAdjust;

    /**
     * 本期费用(本期费用小计+本期费用调整)
     */
    @TableField(value = "reconciliation_amount", typeHandler = JacksonTypeHandler.class)
    private FeeDetailJson reconciliationAmount;

    /**
     * 往期已对账金额
     */
    @TableField(value = "reconciliationed_total_amount")
    private BigDecimal reconciliationedTotalAmount;

    /**
     * 账单日期
     */
    @TableField(value = "statement_date")
    private LocalDateTime statementDate;

    /**
     * 账单类型（1-月结，2-期结，3-总账单，4-自由账单）
     */
    @TableField(value = "statement_type", typeHandler = EnumTypeHandler.class)
    private StatementTypeEnum statementType;

    /**
     * 对账单签署单据ID
     */
    @TableField(value = "contract_id")
    private Long contractId;

    /**
     * 对账单签署单据签署后的链接
     */
    @TableField(value = "contract_signed_url")
    private String contractSignedUrl;

    /**
     * 对账单签署单据待签署链接
     */
    @TableField(value = "contract_created_url")
    private String contractCreatedUrl;


    /**
     * 对账单签署单据签署时间
     */
    @TableField(value = "contract_sign_time")
    private LocalDateTime contractSignTime;


    /**
     * 账单Excel地址
     */
    @TableField(value = "statement_oss_url")
    private String statementOssUrl;

    /**
     * 对账单状态（0-未签署，1-已签署，9-已作废）
     */
    @TableField(value = "statement_status", typeHandler = EnumTypeHandler.class)
    private StatementStatusEnum statementStatus;

    /**
     * 客户扩展信息（包含客户编号、 客户名称 、客户类型、 签约人名称、 签约人手机号 ）
     */
    @TableField(value = "customer_extension", typeHandler = JacksonTypeHandler.class)
    private CustomerExtensionInfoJson customerExtension;


    /**
     * 销售经理ID
     */
    @TableField(value = "sale_manager_id")
    private Long saleManagerId;

    /**
     * 销售经理姓名
     */
    @TableField(value = "sale_manager_name")
    private String saleManagerName;

    /**
     * 部门ID
     */
    @TableField(value = "dept_id")
    private Long deptId;

    /**
     * 损益调整单据
     */
    @TableField(value = "profit_loss_ids")
    private String profitLossIds;

    /**
     * 对账单备注
     */
    @TableField(value = "mark")
    private String mark;

    /**
     * 逻辑删除
     */
    @TableField(value = "is_deleted")
    @TableLogic
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 创建人ID
     */
    @TableField(value = "creator_id")
    private Long creatorId;

    /**
     * 创建人姓名
     */
    @TableField(value = "creator_name")
    private String creatorName;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    /**
     * 更新人ID
     */
    @TableField(value = "updater_id")
    private Long updaterId;

    /**
     * 更新人姓名
     */
    @TableField(value = "updater_name")
    private String updaterName;
}